Options
All
  • Public
  • Public/Protected
  • All
Menu

Basic send functions

Here, to can be <phone Number>@c.us or <phone Number>-<groupId>@g.us or <phone Number><groupId>@g.us

to use these functions it is necessary to initialize the bot, click and learn more.

Send messages separately

Summary

sendText

Sends a text message to given chat

await client.sendText("0000000000@c.us", "A message sent by hydra-bot")
.then((result) => {
    console.log(result); // message result
}).catch((error) => {
    console.log(error); // message error
});

sendFile

Sends file from path

await client.sendFile("0000000000@c.us", './file.pdf', { filename: 'filename' })
.then((result) => {
    console.log(result); // message result
}).catch((error) => {
    console.log(error); // message error
});

sendAudio

Send audio file

await client.sendAudio("0000000000@c.us", './file.mp3')
.then((result) => {
    console.log(result); // message result
}).catch((error) => {
    console.log(error); // message error
});

sendAudioBase64

Send audio base64

await client.sendAudioBase64("0000000000@c.us", base64MP3)
.then((result) => {
    console.log(result); // message result
}).catch((error) => {
    console.log(error); // message error
});

sendImage

Send image message

await client.sendImage("0000000000@c.us", './file.jpg', { caption: 'image text' })
.then((result) => {
    console.log(result); // message result
}).catch((error) => {
    console.log(error); // message error
});

sendImageFromBase64

Send image base64

await client.sendImageFromBase64("0000000000@c.us", base64IMG, { caption: 'image text' })
.then((result) => {
    console.log(result); // message result
}).catch((error) => {
    console.log(error); // message error
});

Generated using TypeDoc